package ACWing.WeeklyRace;
//AcWing 3381. 手机键盘  (打表关键点在记录上次按键的位置)
import java.util.Scanner;

public class PhoneKeyboard {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[]arr={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};
        while (sc.hasNext()) {
            int sum=0,last=-1;
            String s=sc.next();
            char[]arr2=s.toCharArray();
            for (int j = 0; j < arr2.length; j++) {
                int t=arr2[j]-'a';
                for (int i = t; i >=0 ; i--) {
                    if(arr[i]==arr[t]){
                        sum++;
                    }else{
                        break;
                    }


                }if(arr[t]==last){
                    sum+=2;
                }
                last=arr[t];

            }
            System.out.println(sum);
        }


    }
}
